package com.yuyang.gulimall.member.web;

import com.alibaba.fastjson.JSON;
import com.yuyang.common.utils.R;
import com.yuyang.gulimall.member.openfeign.OrderFeignService;
import org.apache.ibatis.annotations.Param;
import org.bouncycastle.math.raw.Mod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;

/**
 * @author yu yang
 * @date 2023/2/12 -14:44
 */
@Controller
public class MemberOrderController {
    @Autowired
    OrderFeignService orderFeignService;
    @GetMapping("memberOrder.html")
    public String orderList(@RequestParam(value = "pageNum",defaultValue = "1")Integer pageNum, Model model){
        HashMap<String, Object> params = new HashMap<>();
        params.put("page",pageNum.toString());
        R r = orderFeignService.listWithItems(params);
        System.out.println(JSON.toJSONString(r));
        model.addAttribute("orders",r);
        return "orderList";
    }
}
